home *** CD-ROM | disk | FTP | other *** search
/ Champak 86 / (Vol 86) My Disc.iso / Games / pet_1112.swf / scripts / DefineSprite_558 / frame_6 / DoAction.as
Text File  |  2009-04-14  |  5KB  |  173 lines

  1. function joePrompt()
  2. {
  3.    trace("joePromt");
  4.    if(_root.idle)
  5.    {
  6.       joeIdle[random(joeIdle.length)].start();
  7.    }
  8.    gameTimeouts.promtTimeout0 = setTimeout(joePrompt,random(10000) + 10000);
  9. }
  10. function stopSounds()
  11. {
  12.    _root.stopGameTimeouts();
  13.    sounds.stopSound("all");
  14. }
  15. function removeItems()
  16. {
  17.    for(var _loc1_ in ezClick2Drags)
  18.    {
  19.       removeClip(ezClick2Drags[_loc1_]);
  20.    }
  21. }
  22. function startDragging(obj)
  23. {
  24.    _root.sounds.phoo03.start();
  25.    eventCover_mc._visible = true;
  26.    obj._visible = true;
  27.    startRocking(obj);
  28.    glow.strength = 0;
  29.    obj.filters = [glow];
  30. }
  31. function garmentRollOver()
  32. {
  33.    if(!this.dragging && !EZClick2Drag.DRAGGING)
  34.    {
  35.       _root.sounds.whoosh.start();
  36.       glow.strength = 30;
  37.       this.filters = [glow];
  38.    }
  39. }
  40. function garmentRollOut()
  41. {
  42.    glow.strength = 0;
  43.    this.filters = [glow];
  44. }
  45. function hitTarget(obj)
  46. {
  47.    _root.sounds.dojoquickturn.start();
  48.    gameTimeouts.joeEncourage = setTimeout(function()
  49.    {
  50.       joeEncouragment[random(joeEncouragment.length + 10)].start();
  51.    }
  52.    ,1200);
  53.    setTimeout(function()
  54.    {
  55.       eventCover_mc._visible = false;
  56.    }
  57.    ,500);
  58.    if(!started)
  59.    {
  60.       showDoneBtn();
  61.    }
  62.    started = true;
  63.    returnSimilarItems(obj);
  64.    randomEars();
  65.    obj._visible = false;
  66.    blue.attachClothes(obj.part,obj.ID);
  67.    _root.printBlue_mc.blue.attachClothes(obj.part,obj.ID);
  68.    blue.barkRandom();
  69.    obj._x = obj.targets[1]._x;
  70.    obj._y = obj.targets[1]._y;
  71.    obj._rotation = 0;
  72.    obj.enabled = false;
  73. }
  74. function snapBack(obj)
  75. {
  76.    this[obj.part + "Wears_mc"][obj.ID + "_mc"].gotoAndStop(1);
  77.    this[obj.part + "Wears_mc"][obj.ID + "_mc"].baseClip_mc._visible = true;
  78.    this[obj.part + "Wears_mc"][obj.ID + "_mc"].useHandCursor = true;
  79.    obj._visible = true;
  80.    obj._xscale = obj.origScale;
  81.    obj._yscale = obj.origScale;
  82.    obj._x = obj.targets[0]._x;
  83.    obj._y = obj.targets[0]._y;
  84.    obj._rotation = obj.origRotation;
  85.    obj.swapDepths(obj.origDepth);
  86.    setTimeout(function()
  87.    {
  88.       obj.enabled = true;
  89.    }
  90.    ,50);
  91. }
  92. function returnSimilarItems(obj)
  93. {
  94.    for(var _loc2_ in wears[obj.part])
  95.    {
  96.       if(wears[obj.part][_loc2_] != obj)
  97.       {
  98.          snapBack(wears[obj.part][_loc2_]);
  99.       }
  100.    }
  101. }
  102. function tweenBack(obj)
  103. {
  104.    obj._visible = true;
  105.    caurina.transitions.Tweener.addTween(obj,{time:0.5,transition:"easeInSine",_y:obj.targets[0]._y,_xscale:obj.origScale,_yscale:obj.origScale});
  106.    caurina.transitions.Tweener.addTween(obj,{time:0.5,transition:"easeInOutSine",_x:obj.targets[0]._x,_rotation:obj.origRotation,onComplete:function()
  107.    {
  108.       this.swapDepths(this.origDepth);
  109.       eventCover_mc._visible = false;
  110.       eval(this.part + "Wears_mc")[this.ID + "_mc"].gotoAndStop(1);
  111.       eval(this.part + "Wears_mc")[this.ID + "_mc"].baseClip_mc._visible = true;
  112.       eval(this.part + "Wears_mc")[this.ID + "_mc"].useHandCursor = true;
  113.    }});
  114. }
  115. function randomEars()
  116. {
  117.    var _loc1_ = random(3);
  118.    switch(_loc1_)
  119.    {
  120.       case 0:
  121.          blue.head.ear_l.play();
  122.          break;
  123.       case 1:
  124.          blue.head.ear_r.play();
  125.          break;
  126.       case 2:
  127.          blue.head.ear_l.play();
  128.          blue.head.ear_r.play();
  129.    }
  130. }
  131. stop();
  132. doors_mc.gotoAndPlay("open");
  133. var sounds = new seven2Classes.seven2SND(this,["JOE_BMMDU_014","JOE_BMMDU_015","JOE_BMMDU_005","JOE_BMMDU_006","JOE_BMMDU_030","JOE_BMMDU_026","done"]);
  134. var joeEncouragment = new Array(sounds.JOE_BMMDU_014,sounds.JOE_BMMDU_015);
  135. var joeIdle = new Array(sounds.JOE_BMMDU_006,sounds.JOE_BMMDU_005);
  136. joePrompt();
  137. sounds.JOE_BMMDU_006.start();
  138. blue.isIdle = true;
  139. var wears = new Array();
  140. var currentClothes = new Object();
  141. for(var prop in ezClick2Drags)
  142. {
  143.    var article = ezClick2Drags[prop];
  144.    article.targets[0] = {_x:article._x,_y:article._y};
  145.    article.targets[1] = rect_mc;
  146.    article.targetActions[0] = tweenBack;
  147.    article.targetActions[1] = hitTarget;
  148.    article.missedTargetsAction = tweenBack;
  149.    article.onDragStart = startDragging;
  150.    article.onRollOver = garmentRollOver;
  151.    article.onRollOut = garmentRollOut;
  152.    article.origDepth = article.getDepth();
  153.    article.origScale = article._xscale;
  154.    article.origRotation = article._rotation;
  155.    if(!wears[article.part])
  156.    {
  157.       wears[article.part] = new Array();
  158.    }
  159.    wears[article.part][article.ID] = article;
  160. }
  161. var glow = new flash.filters.GlowFilter(16777215,1,3,3,30,3);
  162. blue.debugOn = false;
  163. blue.onRelease = function()
  164. {
  165.    blue.barkRandom();
  166. };
  167. insideCloset_mc.onRelease = function()
  168. {
  169.    0;
  170.    undefined;
  171. };
  172. insideCloset_mc.useHandCursor = false;
  173.